{extend name='public/content'}

{block name="title"}
	保存用户信息
{/block}
{block name="body"}
<div class="layui-container">
	{volist name="dresslist" id="data"}
	 <div class="layui-row">
	    <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
	     	电话号码：	{$data.mobile}
	    </div>
	    <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
	  		 用户值：{$data.id}
	    </div>
	     <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
	     	 {if condition="($data.is_default=='1')"}
	   			 <a class="layui-btn layui-btn-normal" data-id="{$data.id}">默认地址</a>
	     	 {else /}
	     	 	 <a class="layui-btn layui-btn-normal setmorendizhi" 
	     	 	 data-id="{$data.id}" data-uid="{$data.uid}">设为默认地址</a>
	     	 {/if}
	    </div>
	    <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
	     	删除： <a href="{:url('user/deleteaddress')}?&id={$data.id}">删除</a><br/>
	    </div>
	    <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
	   		编辑 ：<a href="{:url('user/editordress')}?&id={$data.id}">编辑</a>
	    </div>
	    <div class="layui-col-xs3 layui-col-sm3 layui-col-md3 layui-bg-red">
	   		 地址：{$data.country}|{$data.province}|{$data.city}|{$data.area}
	    </div>
	  </div>
	{/volist}
	</div>
</div>

<a href="{:url('user/index')}">我的</a>
<a href="{:url('user/savedizhi')}">添加地址</a><br/>

{/block}

{block name="script"}
 	<script type="text/javascript">
 		require(['jquery'], function () {
 			$('.setmorendizhi').click(function(event) {
 				let that = this;
 				let id = $(that).data('id');
 				let uid = $(that).data('uid');
 				$.get('{:url("user/setdefaultdress")}?id='+id+"&uid="+uid, function(data) {				
 					window.location.reload();
 				},"json");
 			});
 		})
 			
 	</script>
{/block}

{block name="style"}
 <style type="text/css">
 	
 </style>
{/block}